﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DMS.Logic;

namespace WebUI.library
{
	public partial class ViewItems : System.Web.UI.Page
	{
		int folderId;
		int documentLibraryId;
		
		protected void Page_Load(object sender, EventArgs e)
		{
			if (Request.QueryString["libid"] != null)
			{
				documentLibraryId = int.Parse(Request.QueryString["libid"]);

				var folders = BL.getInstance().getFoldersByLibrary(documentLibraryId, 0);
				folderId = (from f in folders
						   orderby f.ID
						   select f.ID).First();
						   
			}
		}

		protected void btnUpload_Click(object sender, EventArgs e)
		{
			DocumentLibraryLogic docLib = new DocumentLibraryLogic();
			docLib.AddDocument(filUpload.FileName, filUpload.FileName, folderId, filUpload.PostedFile.InputStream);

		}
	}
}
